new Vue({
  el: "#app",
  data() {
    return {
      form: {
        Category_SerialNumber: "",
        Category_Name: "", //表名
      },
      rules: {
        Category_Name: [
          { required: true, message: "请输入类别名称", trigger: "blur" },
        ],
      },
      loading: false,
    };
  },
  mounted() {
    const Category_SerialNumber = sessionStorage.getItem(
      "Category_SerialNumber"
    );
    this.getData(Category_SerialNumber);
  },
  methods: {
    getData(Category_SerialNumber) {
      const _this = this;
      console.log(Category_SerialNumber, "Category_SerialNumber");

      //   return;
      $.ajax({
        // url: "https://service.kdddy.cn/donghuiForRequest/selectByData/EdibleMushroomVariety",
        url: "https://service.kdddy.cn/donghui/generalBusiness/generalQueryByTableNameWithOriginal",
        type: "POST",
        data: {
          Data: "business_category", //表名
          Condition: "Category_SerialNumber='" + Category_SerialNumber + "'", //值
        },
        success: function (data) {
          console.log(1111111111);
          console.log(data, "data");
          _this.form = data[0];
        },
        complete: function (XMLHttpRequest) {
          //   requestPretreatment(XMLHttpRequest); //config/config.js 响应预检
        },
        dataType: "json",
      });
    },
    submitForm(formName) {
      console.log(formName);
      const _this = this;
      console.log(_this.form, "*********");
      let lArray = new Array();
      lArray.push(_this.form);
      let lJSONObject_business_brand = new Object();
      lJSONObject_business_brand.business_category = lArray; //换表
      let lJSONObject_DataSet = new Object();
      lJSONObject_DataSet.Modify = lJSONObject_business_brand;
      console.log(lJSONObject_DataSet);

      //   return;
      $.ajax({
        // headers: requestHeaders(),
        // url: `${BASE_URL2}/generalBusiness/generalPaginationQueryBySQLSerialNumber`,
        url: "https://service.kdddy.cn/donghui/clientOperation/generalSaveForClient",
        type: "POST",
        data: {
          Data: JSON.stringify(lJSONObject_DataSet),
        },
        success: function (Result) {
          console.log(Result);
          if (Result.Status === "success") {
            _this.$message.success("提交成功");
            window.history.go(-1);
          } else {
            _this.$message.error("提交失败，请稍后再试");
          }
        },
        complete: function (XMLHttpRequest) {
          requestPretreatment(XMLHttpRequest); //config/config.js 响应预检
        },
        dataType: "json",
      });
    },
    // resetForm(formName) {
    //     this.$refs[formName].resetFields();
    // },
  },
});
